package com.xiecong.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.xiecong.mapper.LogMapper;
import com.xiecong.pojo.EmpQueryParam;
import com.xiecong.pojo.OperateLog;
import com.xiecong.pojo.PageResult;
import com.xiecong.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogMapper logMapper;

    @Override
    public PageResult<OperateLog> pageQuery(EmpQueryParam pageList) {
        PageHelper.startPage(pageList.getPage(), pageList.getPageSize());
        List<OperateLog> logList = logMapper.pageQuery(pageList);
        Page<OperateLog> pageInfo = (Page<OperateLog>) logList;
        List<OperateLog> rows = pageInfo.getResult();
        Long total = pageInfo.getTotal();
        return new PageResult<OperateLog>(total, rows);
    }
}
